package com.zhipu.resetbalance.pop;

import android.content.Context;
import android.view.View;

import androidx.annotation.NonNull;

import com.lxj.xpopup.core.CenterPopupView;
import com.zhipu.resetbalance.R;
import com.zhipu.resetbalance.listener.ChooseClickCallback;

public class SelectModifyDeletePopup extends CenterPopupView {

    private boolean mSelect;

    public SelectModifyDeletePopup(@NonNull Context context) {

        super(context);
    }

    public SelectModifyDeletePopup(@NonNull Context context,boolean mSelect) {
        super(context);
        this.mSelect = mSelect;
    }


    @Override
    protected int getImplLayoutId() {

        return R.layout.popup_select_modify_delete;
    }


    @Override
    protected void onCreate() {
        super.onCreate();
        if(mSelect){
            findViewById(R.id.select).setVisibility(View.GONE);
            findViewById(R.id.Space1).setVisibility(View.GONE);
        }
        findViewById(R.id.select).setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                if(null != mChooseClickCallback){
                    mChooseClickCallback.onChooseClickCallback(0);
                }
                dismiss();
            }
        });
        findViewById(R.id.modify).setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                if(null != mChooseClickCallback){
                    mChooseClickCallback.onChooseClickCallback(1);
                }
                dismiss();
            }
        });

        findViewById(R.id.delete).setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                if(null != mChooseClickCallback){
                    mChooseClickCallback.onChooseClickCallback(2);
                }
                dismiss();
            }
        });
    }


    private ChooseClickCallback mChooseClickCallback;
    public ChooseClickCallback getChooseClickCallback() {
        return mChooseClickCallback;
    }
    public void setChooseClickCallback(ChooseClickCallback mChooseClickCallback) {
        this.mChooseClickCallback = mChooseClickCallback;
    }
}
